package com.example.demo.scheduling;//package com.example.demo1.scheduling;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.scheduling.annotation.EnableAsync;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import java.time.LocalDateTime;
//
////@Component注解用于对那些比较中立的类进行注释；
//@Configuration
//@EnableScheduling   // 定时任务的开启注解
//@EnableAsync        // 开启异步 多线程
//public class MultithreadScheduleTask {
//
//    @Async
//    @Scheduled(fixedDelay = 1000)  //间隔1秒
//    public void first() throws InterruptedException {
//        //执行体
//        System.out.println("1号定时任务开始: " + LocalDateTime.now().toLocalTime() + "线程: " + Thread.currentThread().getName());
//        Thread.sleep(2000 * 10);
//    }
//
//    @Async
//    @Scheduled(fixedDelay = 2000)
//    public void second() {
//        //执行体
//        System.out.println("2号定时任务开始: " + LocalDateTime.now().toLocalTime() + "线程: " + Thread.currentThread().getName());
//    }
//}
//
//
//
//
